package cn.xx.basic.util;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor

public class AjaxResult {
    private Boolean success = true;
    private String msg = "操作成功";
    //扩展：
    private Object resultObject = null;

    // 优化成链式语法
    public static AjaxResult me() {
        return new AjaxResult();
    }
    //设置链式语法
    public AjaxResult setSuccess (Boolean success) {
        this.success = success;
        return this;
    }

    public AjaxResult(Boolean success, Object resultObject) {
        this.success = success;
        this.resultObject = resultObject;
    }

    public AjaxResult setMsg (String msg) {
        this.msg = msg;
        return this;
    }

    public AjaxResult setResultObject (Object resultObject) {
        this.resultObject = resultObject;
        return this;
    }

}
